<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Lightweight OS (LWOS): Lightweight Operating System</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Lightweight OS (LWOS)
   
   </div>
   <div id="projectbrief">A diminutive operating system</div>
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li class="current"><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="headertitle">
<div class="title">Lightweight Operating System </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>&copy; Copyright 2012 by Al Williams (<a href="mailto:al.williams@awce.com">al.williams@awce.com</a>) Distributed under the terms of the GNU Lesser General Public License.</p>
<h2><a class="anchor" id="license"></a>
License</h2>
<p>LWOS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.</p>
<p>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.</p>
<p>You should have received a copy of the GNU General Public License along with this program. If not, see &lt;<a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>&gt;.</p>
<h2><a class="anchor" id="about"></a>
About</h2>
<p>This is a very simple and lightweight cooperative multitasking kernel. Features include:</p>
<ul>
<li>Prioritization</li>
<li>Task local storage</li>
<li>Ability for a task to directly yield to another task</li>
<li>Semaphore-like waiting</li>
<li>Ability to sleep for a certain amount of time (with some user-supplied support) Using LWOS is extremely simple. The file <em><a class="el" href="sample_8c.html" title="Simple example of LWOS features.">sample.c</a></em> shows a simple example. Minimally, you have to build a task table using the <em>TASKTABLE</em> macro and some task functions. If you want to use time-based sleeping you also need to provide a task to keep the scheduler's tick count (see <em>sleeping</em>). </li>
</ul>
<h2><a class="anchor" id="priority"></a>
Task Priority</h2>
<p>Entries in the task table are ordered by priority with the first entry having the highest priority. If the first task is always ready, for example, it will always run unless it does a directed yield. </p>
<h2><a class="anchor" id="func"></a>
Writing Task Functions</h2>
<p>A task function is a simple C function that takes a pointer to <em>Task</em> and returns an integer. The scheduler will run the function until it returns. A return of 1 allows the schedule to continue execution with the highest priority task that is ready (which may be the same function). A non-zero return will yield to a specific task (1-based), or the first task that is ready at that priority level or lower. Any wait or yield will cause the function to reenter at the start on the next execution. You may yield from a non-top-level function as long as TASK_NO_SETJMP is not defined. </p>
<h2><a class="anchor" id="sleeping"></a>
Implementing Sleep</h2>
<p>Because LWOS is portable, it depends on a user task to update the <em>task_tick</em> variable. If you do not plan to use <em>task_sleep</em> then you do not have to update <em>task_tick</em>. More to follow </p>
</div></div><!-- contents -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>



<hr class="footer"/><address class="footer"><small>
Generated on Mon Nov 19 2012 22:30:11 for Lightweight OS (LWOS) by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>

</body>
</html>
